

local mt = ac.skill['压倒性优势']
mt.targettype = '点'
mt.range = 600
mt.effectArt = [[war3mapImported\OverwhelmingOdds.mdl]]


function mt:on_cast_shot()
    local hero = self.owner
    local target = self.target
    local point = target:get_point()
    local damage = hero:get('攻击') * self.data1/100
    point:add_effect(self.effectArt):remove()
    ac.wait(300,function()
        hero:aoe_damage(point,350,damage,self)
        hero:add_buff '压倒性优势-护甲'{data1 = self.data2,art = self.art}
    end)
end

local buff = ac.buff['压倒性优势-护甲']
buff.time = 5
function buff:on_add()
    local hero = self.owner
    self:gc(hero:add('护甲加成',self.data1))
end


local mt = ac.skill['勇气之霎']
mt.targetArt = [[Abilities\Spells\Orc\Bloodlust\BloodlustTarget.mdl]]
function mt:on_add()
    local hero = self.owner
    self:gc(hero:event '单位-受到攻击命中'(function(_,_,target,data)
        if math.random(100)<=self.data1 then
            local point1 = hero:get_point()
            local point2 = target:get_point()
            local angle = point1/point2
            local point3 = point2 - {angle,100}
            local effect = point3:effect{
                model = hero:get_model(),
                hide_when_remove = true,
                angle = angle + 180,
                speed = 2,
                time = 0.7,
            }
            effect:play_animation('attack')
            effect:set_color(100,100,100,50)

            ac.wait(200,function()
                local damage = hero:get('攻击') * self.data2/100
                hero:add('生命',hero:get('攻击') * 0.2)
                target:damage{
                    source = hero,
                    damage = damage,
                    skill = self,
                }
            end)
        end
    end))
end